<?php
	include_once '../../../ketnoi.php';
	$MaSoTietKiem = $_GET["masotietkiem"];
	$sqlsotietkiem = "SELECT * FROM sotietkiem WHERE MaSoTietKiem ='$MaSoTietKiem'";
	$dssotietkiem = mysql_query($sqlsotietkiem);
	$dongsotietkiem = mysql_fetch_array($dssotietkiem);
	$SoTienGui = $dongsotietkiem["SoDuKyHanTT"];
	
	$sqlloaikyhan = "SELECT * FROM loaikyhan WHERE KyHan = 0";
	$dsloaikyhan = mysql_query($sqlloaikyhan);
	$dongloaikyhan = mysql_fetch_array($dsloaikyhan);
	$MaLoaiKyHan = $dongloaikyhan["MaLoaiKyHan"];
	
	$sqllaisuatgui = "SELECT * FROM laisuatgui WHERE MaLoaiKyHan  = $MaLoaiKyHan AND HangThang = 1 AND HangNam = 1";
	$dslaisuatgui = mysql_query($sqllaisuatgui);
	$donglaisuatgui = mysql_fetch_array($dslaisuatgui);
	$PhanTramLaiSuatGui = $donglaisuatgui["PhanTramLaiSuatGui"];
	date_default_timezone_set('Asia/Ho_Chi_Minh');
	$NgayThucGui =  round(abs(strtotime(date("Y-m-d", time()))-strtotime($dongsotietkiem["NgayMoSo"]))/86400);
	echo round(($SoTienGui * ((float)$PhanTramLaiSuatGui / 100) * $NgayThucGui)/30);
?>